using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.Common;
using Husb.Data;
using Husb.DataUtil;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Caching;

using CentralOffice.Admin.Data;

using AddressTable = CentralOffice.Admin.Data.AddressDataSet.addressDataTable;
using AddressRow = CentralOffice.Admin.Data.AddressDataSet.addressRow;
namespace CentralOffice.Admin.DataAccess
{
    public class AddressAdapter : DataAccessAdapter<Admin.Data.AddressDataSet, AddressTable, AddressRow>
    {
        public AddressAdapter()
        {
            this.TableName = "address";
            DeleteStoredProc = "Address_DeleteAddress";

            GetAllStoredProc = "Address_SelectAddressAll";
            InsertStoredProc = "Address_InsertAddress";
            UpdateStoredProc = "Address_UpdateAddress";
            FindStoredProc = "Address_SelectAddressDynamic";
            GetByIdStoredProc = "Address_SelectAddress";
            GetPagedStoredProc = "Address_SelectAddressPaged";
            GetRowCountStoredProc = "Address_SelectAddressRowCount";
        }

        protected override void PopulateInsertParameters(Database db, DbCommand cmd)
        {
            db.AddInParameter(cmd, "id", DbType.Guid, "id", DataRowVersion.Current);
            db.AddInParameter(cmd, "UserId", DbType.AnsiString, "UserId", DataRowVersion.Current);
            db.AddInParameter(cmd, "GroupId", DbType.AnsiString, "GroupId", DataRowVersion.Current);
            db.AddInParameter(cmd, "PsnName", DbType.String, "PsnName", DataRowVersion.Current);
            db.AddInParameter(cmd, "sex", DbType.AnsiStringFixedLength, "sex", DataRowVersion.Current);
            db.AddInParameter(cmd, "NickName", DbType.String, "NickName", DataRowVersion.Current);
            db.AddInParameter(cmd, "Birthday", DbType.AnsiString, "Birthday", DataRowVersion.Current);
            db.AddInParameter(cmd, "MiniStration", DbType.AnsiString, "MiniStration", DataRowVersion.Current);
            db.AddInParameter(cmd, "Mate", DbType.AnsiString, "Mate", DataRowVersion.Current);
            db.AddInParameter(cmd, "Child", DbType.AnsiString, "Child", DataRowVersion.Current);
            db.AddInParameter(cmd, "DeptName", DbType.AnsiString, "DeptName", DataRowVersion.Current);
            db.AddInParameter(cmd, "AddDept", DbType.AnsiString, "AddDept", DataRowVersion.Current);
            db.AddInParameter(cmd, "PostNoDept", DbType.AnsiString, "PostNoDept", DataRowVersion.Current);
            db.AddInParameter(cmd, "TelNoDept", DbType.AnsiString, "TelNoDept", DataRowVersion.Current);
            db.AddInParameter(cmd, "FaxNoDept", DbType.AnsiString, "FaxNoDept", DataRowVersion.Current);
            db.AddInParameter(cmd, "AddHome", DbType.String, "AddHome", DataRowVersion.Current);
            db.AddInParameter(cmd, "PostNoHome", DbType.AnsiString, "PostNoHome", DataRowVersion.Current);
            db.AddInParameter(cmd, "TelNoHome", DbType.AnsiString, "TelNoHome", DataRowVersion.Current);
            db.AddInParameter(cmd, "MobilHome", DbType.AnsiString, "MobilHome", DataRowVersion.Current);
            db.AddInParameter(cmd, "Email", DbType.AnsiString, "Email", DataRowVersion.Current);
            db.AddInParameter(cmd, "QqNo", DbType.AnsiString, "QqNo", DataRowVersion.Current);
            db.AddInParameter(cmd, "MSN", DbType.AnsiString, "MSN", DataRowVersion.Current);
            db.AddInParameter(cmd, "Notes", DbType.String, "Notes", DataRowVersion.Current);
            db.AddInParameter(cmd, "PsnNo", DbType.Int32, "PsnNo", DataRowVersion.Current);
            db.AddInParameter(cmd, "SmsFlag", DbType.Int32, "SmsFlag", DataRowVersion.Current);
        }
    }
}
